﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BO.Management.QueryBuilder
{
    public class QueryParameter<T> : BaseQueryParameter
    {
        public T Value { get; set; }

        public override string ToString()
        {

            String value;
            if (this.Value is String)
                value = String.Format("'{0}'", this.NormalizeQueryParameter(this.Value.ToString()));
            else if (this.Value is DateTime)
                value = String.Format("'{0}'",Convert.ToDateTime(this.Value).ToString("yyyy.MM.dd.HH.mm.ss"));
            else
                value = this.Value.ToString();

            return String.Format("{0} {1} {2}", this.ParameterName, this.GetOperator(), value);
        }

        public override Object GetValue()
        {
            return this.Value;
        }

    }

    public class QueryParameters : List<BaseQueryParameter>
    {

    }

}
